<?php
namespace app\admin\model;
use app\common\model\StoreSetmeal as Model;
use think\facade\Db;
use think\facade\Log;

/**
 * 门店套餐表
 */
class StoreSetmeal extends Model
{
    /**
     * 同步权限
     * @return void
     */
    static function sync_roles($id,$roles)
    {
        // 查询套餐相关商家
        $admin_roles_id = Store::where('setmeal_id',$id)->column('admin_roles_id');
        // 查询关联管理员角色组
        StoreRole::where('id','in',$admin_roles_id)->update([
            'roles' => implode(',',array_filter($roles)),
        ]);
        return true;
    }
}